import { createRouter, createWebHistory } from 'vue-router'
import { UserFilled } from '@vicons/carbon'
import { CardOutline, Settings, ListSharp } from '@vicons/ionicons5'
import { ContentSettings20Filled, DataHistogram24Filled } from '@vicons/fluent'

import type { RouteRecordRaw } from 'vue-router'
import Layout from '@/views/layout/index.vue'

export const routes: RouteRecordRaw[] = [
    {
        path: '/',
        redirect: '/user/list'
    },
    {
        path: '/login',
        name: 'Login',
        // route level code-splitting
        // this generates a separate chunk (About.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import('@/views/setup/Login.vue')
    },

    // {
    //     path: '/statistics',
    //     name: 'Statistics',
    //     redirect: '/statistics/assets',
    //     meta: {
    //         title: '统计',
    //         icon: DataHistogram24Filled
    //     },
    //     component: Layout,
    //     children: [

    //     ]
    // },

    {
        path: '/user',
        name: 'User',
        redirect: '/user/list',
        meta: {
            title: '用户管理',
            icon: UserFilled
        },
        component: Layout,
        children: [
            {
                path: '/user/list',
                name: 'UserList',
                meta: {
                    title: '用户列表'
                },
                component: () => import('@/views/user/list/index.vue')
            },

            {
                path: '/user/agent',
                name: 'AgentList',
                meta: {
                    title: '代理列表'
                },
                component: () => import('@/views/user/agent/index.vue')
            },

            {
                path: '/user/sms',
                name: 'SMSList',
                meta: {
                    title: '验证码列表'
                },
                component: () => import('@/views/user/sms/index.vue')
            }
        ]
    },

    {
        path: '/card',
        name: 'Card',
        redirect: '/card/list',
        meta: {
            title: '卡片管理',
            icon: CardOutline
        },
        component: Layout,
        children: [
            {
                path: '/card/mastercard',
                name: 'CardMastercard',
                meta: {
                    title: '万事达卡'
                },
                component: () => import('@/views/card/mastercard/index.vue')
            },

            {
                path: '/card/transfercard',
                name: 'CardTransfercard',
                meta: {
                    title: '转账卡'
                },
                component: () => import('@/views/card/transfercard/index.vue')
            }
        ]
    },

    {
        path: '/bill',
        name: 'Bill',
        redirect: '/bill/wallet',
        meta: {
            title: '账单管理',
            icon: ListSharp
        },
        component: Layout,
        children: [
            {
                path: '/bill/assets',
                name: 'BillAssets',
                meta: {
                    title: '资金统计'
                },
                component: () => import('@/views/bill/assets/index.vue')
            },
            {
                path: '/bill/wallet',
                name: 'WalletBill',
                meta: {
                    title: '钱包账单'
                },
                component: () => import('@/views/bill/wallet/index.vue')
            },
            {
                path: '/bill/mastercard',
                name: 'MastercardBill',
                meta: {
                    title: '万事达卡账单'
                },
                component: () => import('@/views/bill/mastercard/index.vue')
            },

            {
                path: '/bill/remittance',
                name: 'RemittanceBill',
                meta: {
                    title: '汇款账单'
                },
                component: () => import('@/views/bill/remittance/index.vue')
            },

            // {
            //     path: '/bill/card',
            //     name: 'CardBill',
            //     meta: {
            //         title: '卡账单'
            //     },
            //     component: () => import('@/views/bill/card/index.vue')
            // },

            {
                path: '/bill/reserveFund',
                name: 'ReserveFund',
                meta: {
                    title: '备付金'
                },
                component: () => import('@/views/bill/reserve-fund/index.vue')
            }
        ]
    },

    {
        path: '/content',
        name: 'Content',
        redirect: '/content/fee',
        meta: {
            title: '内容中心',
            icon: ContentSettings20Filled
        },
        component: Layout,
        children: [
            {
                path: '/content/message',
                name: 'ContentMessage',
                meta: {
                    title: '站内通知消息'
                },
                component: () => import('@/views/content/message/index.vue')
            },
            {
                path: '/content/messageType',
                name: 'ContentMessageType',
                component: () => import('@/views/content/message/MessageType.vue')
            },
            {
                path: '/content/ad',
                name: 'ContentAd',
                meta: {
                    title: '广告'
                },
                component: () => import('@/views/content/ad/index.vue')
            },
            {
                path: '/content/qa',
                name: 'ContentQa',
                meta: {
                    title: '热门问题'
                },
                component: () => import('@/views/content/qa/index.vue')
            }
        ]
    },

    {
        path: '/config',
        name: 'Config',
        redirect: '/config/fee',
        meta: {
            title: '配置',
            icon: Settings
        },
        component: Layout,
        children: [
            {
                path: '/config/fee',
                name: 'FeeConfig',
                meta: {
                    title: '费率配置'
                },
                component: () => import('@/views/config/fee/index.vue')
            }
        ]
    }
]

const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL),
    routes
})

export default router
